package com.share.user.rest;

import com.share.user.api.UserApi;
import com.share.user.bean.User;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Calendar;
import java.util.Date;

/**
 * author:caifan
 * date:2019/4/28
 */
@RestController
public class UserRest implements UserApi {
    @Override
    public String getUsername(@RequestParam("username") String username) {
        return username;
    }

    @Override
    public User getUserByBirth(@RequestParam("birth") Date birth) {
        User user = new User();
        Calendar calendar= Calendar.getInstance();
        calendar.setTime(birth);
        calendar.add(Calendar.DAY_OF_YEAR, -10);
        user.setBirth(calendar.getTime());
        return user;
    }
}
